package com.zhuhao.design_mode.behavioral_pattern.observer_pattern;

/**
 * 观察者1
 *
 * @Author zhuhao
 * @Date 2022/5/29 21:09
 * @desc
 */
public class StatisticsDisplay implements Observer {

    /**
     * 类被创建时需要将自身注册到被观察者维护的观察者列表中
     *
     * @param weatherData
     */
    public StatisticsDisplay(Subject weatherData) {
        weatherData.registerObserver(this);
    }

    @Override
    public void update(float temperature, float humidity, float pressure) {
        System.out.println("statisticsDisplay.update: " + temperature + " " + humidity + " " + pressure);
    }
}
